import { NestFactory } from '@nestjs/core';
import {NestExpressApplication} from '@nestjs/platform-express';
import {DocumentBuilder, SwaggerModule} from '@nestjs/swagger';
import { AppModule } from './app.module';

async function bootstrap() {
  const app = await NestFactory.create<NestExpressApplication>(AppModule);
  app.enableCors();
  app.useStaticAssets('static/uploads', {
    prefix: '/uploads',
  });
  const config = new DocumentBuilder()
    .setTitle('网上书店购物网站API')
    .setDescription('网上书店购物网站前台API')
    .setVersion('1.0')
    .addBearerAuth()
    .build()
  const document = SwaggerModule.createDocument(app, config);
  SwaggerModule.setup("api-docs", app, document);
  await app.listen(process.env.WEB_PORT);
}
bootstrap();
